package com.mxchip.livestar.original.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

/***
 *** Created by  com.duobeiyun.dbfivedbox.receiver by yangge on 2018/6/7 
 *** mail:ge123.yang@gmail.com
 **/
public class HdmiReceiver extends BroadcastReceiver {

    private static final String TAG = "HdmiReceiver";
    private static String HDMIINTENT = "android.intent.action.HDMI_PLUGGED";
    private static String STATE = "state";

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (HDMIINTENT.equals(action)) {
            boolean booleanExtra = intent.getBooleanExtra(STATE, false);
            if (booleanExtra) {
                //hdmi已经插入
                Log.d(TAG, "onReceive: hdmi已经插入");
                Toast.makeText(context, "hdmi已经插入", Toast.LENGTH_SHORT).show();
            } else {
                Log.d(TAG, "onReceive: hdmi已经拔出");
                //hdmi已经取消
                
                Toast.makeText(context, "hdmi已经拔出", Toast.LENGTH_SHORT).show();
            }
        }

    }
}
